package com.wu.client.controller;

import com.wu.client.service.MvService;
import com.wu.client.vo.res.PageResp;
import com.wu.client.vo.res.mv.MvBaseResp;
import com.wu.client.vo.res.mv.MvResp;
import com.wu.common.convertion.result.Result;
import com.wu.common.convertion.result.Results;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * @author Cousin
 * @date 2025/3/15
 * @Description
 */
@RestController
@RequestMapping("mvs")
@RequiredArgsConstructor
public class MvController {
    private final MvService mvService;
    //http://localhost:8888/api/mvs?page=1&limit=20&regionId=1&versionId=2&sort=latest
    @GetMapping
    public Result<PageResp<MvBaseResp>> getMvs(@RequestParam Integer page,@RequestParam Integer limit,@RequestParam(required = false) Long userId,
                                               @RequestParam(required = false) Integer region,@RequestParam(required = false) Integer type,
                                               @RequestParam(required = false) Integer language,
                                               @RequestParam(required = false) String sort){
        return Results.success(mvService.getMvs(page,limit,userId,region,language,type,sort));
    }
    @GetMapping("/artist/{artistId}")
    //http://localhost:8888/api/mvs/artist/1?userId=1&page=1&limit=8
    public Result<PageResp<MvBaseResp>> getArtistMv(@PathVariable Long artistId,@RequestParam(required = false) Long userId
    ,@RequestParam(defaultValue = "1") Integer page,@RequestParam(defaultValue = "8") Integer limit){
        return Results.success(mvService.getArtistMv(artistId,userId,page,limit));
    }

    //http://localhost:8888/api/mvs/artist/1
    @GetMapping("mvDetail/{id}")
    public Result<MvResp> getMvDetail(@PathVariable Long id,@RequestParam(required = false) Long userId){
        return Results.success(mvService.getMvDetail(id,userId));
    }
    //http://localhost:8888/api/mvs/similar?id=2
    @GetMapping("similar")
    public Object getSimilarMv(@RequestParam Long id){

    return "{\n" +
            "  \"success\": true,\n" +
            "  \"data\": {\n" +
            "    \"items\": [\n" +
            "      {\n" +
            "        \"id\": \"3\",\n" +
            "        \"title\": \"Bad Guy (Live)\",\n" +
            "        \"artists\": \"Billie Eilish\",\n" +
            "        \"artistId\": \"4\",\n" +
            "        \"cover\": \"/placeholder.svg?height=300&width=300\",\n" +
            "        \"url\": \"/videos/mv3.mp4\",\n" +
            "        \"duration\": 194,\n" +
            "        \"releaseDate\": \"2019-03-29\",\n" +
            "        \"playCount\": 8000000,\n" +
            "        \"likes\": 400000,\n" +
            "        \"isLiked\": false,\n" +
            "        \"description\": \"Billie Eilish在格莱美颁奖典礼上的现场表演...\",\n" +
            "        \"regionId\": 3,\n" +
            "        \"versionId\": 2\n" +
            "      },\n" +
            "      {\n" +
            "        \"id\": \"5\",\n" +
            "        \"title\": \"Blinding Lights\",\n" +
            "        \"artists\": \"The Weeknd\",\n" +
            "        \"artistId\": \"6\",\n" +
            "        \"cover\": \"/placeholder.svg?height=300&width=300\",\n" +
            "        \"url\": \"/videos/mv5.mp4\",\n" +
            "        \"duration\": 203,\n" +
            "        \"releaseDate\": \"2019-11-29\",\n" +
            "        \"playCount\": 12000000,\n" +
            "        \"likes\": 600000,\n" +
            "        \"isLiked\": false,\n" +
            "        \"description\": \"《Blinding Lights》是The Weeknd的热门单曲，收录于专辑《After Hours》...\",\n" +
            "        \"regionId\": 3,\n" +
            "        \"versionId\": 1\n" +
            "      },\n" +
            "      {\n" +
            "        \"id\": \"6\",\n" +
            "        \"title\": \"Butter\",\n" +
            "        \"artists\": \"BTS (防弹少年团)\",\n" +
            "        \"artistId\": \"3\",\n" +
            "        \"cover\": \"/placeholder.svg?height=300&width=300\",\n" +
            "        \"url\": \"/videos/mv6.mp4\",\n" +
            "        \"duration\": 164,\n" +
            "        \"releaseDate\": \"2021-05-21\",\n" +
            "        \"playCount\": 14000000,\n" +
            "        \"likes\": 700000,\n" +
            "        \"isLiked\": false,\n" +
            "        \"description\": \"《Butter》是BTS的英语单曲，这首歌打破了多项YouTube记录...\",\n" +
            "        \"regionId\": 4,\n" +
            "        \"versionId\": 1\n" +
            "      }\n" +
            "    ],\n" +
            "    \"total\": 3\n" +
            "  }\n" +
            "}\n";
}
    @GetMapping("query")
    public Object queryInPage(@RequestParam Integer page,@RequestParam Integer limit,@RequestParam String query){
        return "{\n" +
                "  \"success\": true,\n" +
                "  \"data\": {\n" +
                "    \"items\": [\n" +
                "      {\n" +
                "        \"id\": \"3\",\n" +
                "        \"title\": \"Bad Guy (Live)\",\n" +
                "        \"artists\": \"Billie Eilish\",\n" +
                "        \"artistId\": \"4\",\n" +
                "        \"cover\": \"/placeholder.svg?height=300&width=300\",\n" +
                "        \"url\": \"/videos/mv3.mp4\",\n" +
                "        \"duration\": 194,\n" +
                "        \"releaseDate\": \"2019-03-29\",\n" +
                "        \"playCount\": 8000000,\n" +
                "        \"likes\": 400000,\n" +
                "        \"isLiked\": false,\n" +
                "        \"description\": \"Billie Eilish在格莱美颁奖典礼上的现场表演...\",\n" +
                "        \"regionId\": 3,\n" +
                "        \"versionId\": 2\n" +
                "      },\n" +
                "      {\n" +
                "        \"id\": \"5\",\n" +
                "        \"title\": \"Blinding Lights\",\n" +
                "        \"artists\": \"The Weeknd\",\n" +
                "        \"artistId\": \"6\",\n" +
                "        \"cover\": \"/placeholder.svg?height=300&width=300\",\n" +
                "        \"url\": \"/videos/mv5.mp4\",\n" +
                "        \"duration\": 203,\n" +
                "        \"releaseDate\": \"2019-11-29\",\n" +
                "        \"playCount\": 12000000,\n" +
                "        \"likes\": 600000,\n" +
                "        \"isLiked\": false,\n" +
                "        \"description\": \"《Blinding Lights》是The Weeknd的热门单曲，收录于专辑《After Hours》...\",\n" +
                "        \"regionId\": 3,\n" +
                "        \"versionId\": 1\n" +
                "      },\n" +
                "      {\n" +
                "        \"id\": \"6\",\n" +
                "        \"title\": \"Butter\",\n" +
                "        \"artists\": \"BTS (防弹少年团)\",\n" +
                "        \"artistId\": \"3\",\n" +
                "        \"cover\": \"/placeholder.svg?height=300&width=300\",\n" +
                "        \"url\": \"/videos/mv6.mp4\",\n" +
                "        \"duration\": 164,\n" +
                "        \"releaseDate\": \"2021-05-21\",\n" +
                "        \"playCount\": 14000000,\n" +
                "        \"likes\": 700000,\n" +
                "        \"isLiked\": false,\n" +
                "        \"description\": \"《Butter》是BTS的英语单曲，这首歌打破了多项YouTube记录...\",\n" +
                "        \"regionId\": 4,\n" +
                "        \"versionId\": 1\n" +
                "      }\n" +
                "    ],\n" +
                "    \"total\": 3\n" +
                "  }\n" +
                "}\n";
    }
}
